//
//  ViewController.swift
//  SSExtensions
//
//  Created by 松松 on 04/10/2019.
//  Copyright (c) 2019 松松. All rights reserved.
//

import UIKit
@_exported
import SSExtensions

class TextView: UIView {


    override func draw(_ rect: CGRect) {
        super.draw(rect)
//        UIGraphicsGetCurrentContext()?.move(to: CGPoint(x: 50, y: 50))
        UIGraphicsGetCurrentContext()?.addLines(between: [CGPoint(x: 30, y: 50),CGPoint(x: 80, y: 80),CGPoint(x: 70, y: 80),CGPoint(x: 90, y: 70),CGPoint(x: 100, y: 30),CGPoint(x: 50, y: 30)])

        UIGraphicsGetCurrentContext()?.setStrokeColor(UIColor.red.cgColor)
        UIGraphicsGetCurrentContext()?.setShadow(offset: CGSize(width: 3, height: 3), blur: 0, color: UIColor.yellow.cgColor)
        UIGraphicsGetCurrentContext()?.strokePath()
    }

}

extension UIView{
    func addSs(){
        UIGraphicsGetCurrentContext()?.addLines(between: [CGPoint(x: 30, y: 50),CGPoint(x: 80, y: 80),CGPoint(x: 70, y: 80),CGPoint(x: 90, y: 70),CGPoint(x: 100, y: 30),CGPoint(x: 50, y: 30)])

        UIGraphicsGetCurrentContext()?.setStrokeColor(UIColor.red.cgColor)
        UIGraphicsGetCurrentContext()?.setShadow(offset: CGSize(width: 3, height: 3), blur: 0, color: UIColor.yellow.cgColor)
        UIGraphicsGetCurrentContext()?.strokePath()
    }
}

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        //        let testView = TextView(frame: CGRect(x: 100, y: 100, width: 100, height: 100))
        //        testView.backgroundColor = UIColor.blue
//        view.addSubview(testView)
        view.addGradientBg(from: UIColor.blue, to: UIColor.red)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}

